import request from "@/utils/request.ts";
import Enum from "@/api/detailApi/enum.ts";
import type { Response } from "@/types/commonTypes/commonTypes.ts";
import type { CommentInfo, CommentPageParams, GoodDetail,Comment } from "@/types/detailTypes/detailTypes.ts";
import type { Good } from "@/types/homeTypes/homeTypes.ts";
/*获取商品详情的接口*/
export const fetchGoodDetailAPI = (id: string): Promise<Response<GoodDetail>> => request.get<any, Response<GoodDetail>>(Enum.goodDetail, { params: { id } });
/*获取同类推荐或者猜你喜欢的接口*/
export const fetchRelevantListAPI = (id: string, limit: number): Promise<Response<Good[]>> => request.get<any, Response<Good[]>>(Enum.relevant, { params: { id, limit } });
/*获取热销推荐的接口*/
export const fetchHotListAPI = (id: string, limit: number, type: number): Promise<Response<Good[]>> => request.get<any, Response<Good[]>>(Enum.hot, { params: { id, limit, type } });
/*获取商品评价信息的接口*/
export const fetchEvaluateInfoAPI = (id: string): Promise<Response<CommentInfo>> => request.get<any, Response<CommentInfo>>(`${Enum.evaluate}/${id}/evaluate`);
/*获取商品评价列表的接口*/
export const fetchCommentListAPI = (id: string, params: CommentPageParams): Promise<Response<Comment>> => request.get<any, Response<Comment>>(`${Enum.commentList}/${id}/evaluate/page`, { params });
